package com.codefish.codefishseckill.utils;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/08/30 下午 05:18
 */
public class ResponseUtil {
    public static void out(HttpServletResponse response, Object respBean) {

        response.setHeader("content-type", "application/json;charset=utf-8");

        try (PrintWriter writer = response.getWriter()) {
            writer.println(JSON.toJSONString(respBean));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
